package com.ceprei.common.exception;

/**
 * 自定义异常
 *
 * @author zhou minghao
 * @date 2024/11/27
 * @description
 */
public class GlobalException extends RuntimeException {

    /**
     * 错误码，用于全局异常拦截器使用
     */
    private Integer code;

    public GlobalException(String msg) {
        super(msg);
        this.code = 500;
    }

    public GlobalException(int code, String msg) {
        super(msg);
        this.code = code;
    }

    public GlobalException(String message, Throwable cause) {
        super(message, cause);
        this.code = 500;
    }

    public GlobalException(Throwable cause) {
        super(cause);
        this.code = 500;
    }

    public Integer getCode() {
        return code;
    }
}
